<?php 

	include_once "payment_settings.php";
	$url = "http://word-press.orisale.ru/blog/wp-admin/admin-post.php/?";
	$act = "action=wpse_79898";

$post_var = array();


if( isset($_POST['amount']) ){
	$post_var['amount'] = $_POST['amount'];
}
if( isset($_POST['userid']) ){
	$post_var['userid'] = $_POST['userid'];
}
if( isset($_POST['paymentid']) ){
	$post_var['paymentid'] = $_POST['paymentid'];
}
if( isset($_POST['key']) ){
	$post_var['key'] = $_POST['key'];
}
if( isset($_POST['paymode']) ){
	$post_var['paymode'] = $_POST['paymode'];
}
if( isset($_POST['userid_extra']) ){
	$post_var['userid_extra'] = $_POST['userid_extra'];
}
if( isset($_POST['orderid']) ){
	$post_var['orderid'] = $_POST['orderid'];
}

if( isset($_POST['test']) ){
	$post_var['test'] = $_POST['test'];
}



$secret = payment_settings()['secret'];

$key = md5($post_var['amount'].$post_var['userid'].$post_var['paymentid'].$secret);

$post_var['keygen'] = $key;

$post_var_isset = array();

    foreach ($post_var as $key => $value) {
		if($value != null){
			$post_var_isset[$key] =  "&".$key."=".$value;
		}
	}
	//echo json_encode($post_var_isset);

	$str_param = implode('', $post_var_isset);
	

	$loc = "Location: " . $url . $act .  $str_param;
	echo $loc;
	header($loc);
	
?>